package exception;

import classics.Array;

import java.util.Arrays;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始。");
        try{//try不能单独存在
            String[] a = new String[2];
            System.out.println(a[3]);
        }catch (StringIndexOutOfBoundsException|NullPointerException exception ){
            System.out.println("发生字符串下标越界异常或者空指针异常。");
        }catch (Exception e){//子上父下，兜底操作
            System.out.println("出错了");
        }
    }
}
